<%@page import="com.sq.partner.manager.mybatis.model.TradProdInst"%>
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8" %>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<% String path=request.getContextPath(); String basePath=request.getScheme()+ "://" + request.getServerName() + ":" + request.getServerPort() + path+ "/"; %>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
	<base href="<%=basePath%>">
	<title>产品编辑</title>

	<style type="text/css">
		input.fieldError {
			border: 1px solid #ffb042;
			background-color: #fffbf5;
		}
		textarea.fieldError {
			border: 1px solid #ffb042;
			background-color: #fffbf5;
		}
		label.fieldError {
			line-height: 23px;
			color: #ffb042;
			padding-left: 6px;
		}
		.ration_table_title{ width:100%;border-left:1px #bbcddb solid; border-top:1px #bbcddb solid; background-color:#f6f7f9;}
		.ration_table_title th{ color:#343233; width:12%; text-align:right; line-height:26px; border-bottom:1px #bbcddb solid; border-right:1px #bbcddb solid;font-weight:normal; padding-right:10px;}
		.ration_table_title td{ color:#343233; text-align:left; line-height:26px; border-bottom:1px #bbcddb solid; border-right:1px #bbcddb solid;   padding:5px 0 5px 10px;}
		.ration_table{ width:100%;  border-left:1px #bbcddb solid; border-top:1px #bbcddb solid; background-color:#f6f7f9;font-size: 12px;}
		.ration_table th{ color:#343233; width:11%; text-align:center; line-height:26px; border-bottom:1px #bbcddb solid; border-right:1px #bbcddb solid; background-color:#f6f7f9;}
		.ration_table td{text-align:center; line-height:26px;border-bottom:1px #bbcddb solid; border-right:1px #bbcddb solid;}
		.ration_table .table_02 td, .table_02 .content_table_1 td{padding-left: 2px;padding-right: 2px}

	</style>
	<%@ include file="/WEB-INF/jsp/common/common.jsp" %>
	<script src="js/jquery.validate.js" type="text/javascript" ></script>
	<script src="js/jquery.divbox.js" type="text/javascript"></script>
	<script src="js/json2.js" type="text/javascript"></script>
	<script type="text/javascript">
		var startP=1;
		var tradProdCode='${product.prodCode}';
		var tradprodprop='${product.epolicyCode}'
		var isRation='${product.isRation}'
		var Formstatus=true;
		var levelUpArr = new Array('1','2','3','4','5','6');
		var editPageRiskCount='${riskCount}'
		var editPageRationCount = '${fn:length(rationList)}'
		//是否分期
		var isByStaged = '${product.isByStaged}';
		//批减扣除手续费比例字段
		var pjfee = '${product.pjfee}';
		//医疗类产品字段
		var waitStage ='${product.waitStage}';
		var yearDeductible ='${product.yearDeductible}';
		var payRate ='${product.payRate}';
		var claimLimit ='${product.claimLimit}';
		var graceStage ='${product.graceStage}';
		var isSocial1 ='${product.isSocial}';
		var specialCodeName = new Array();
		var riskMainType = '${riskMainType}';//加载当前产品模板所对应的 产品大类
        // 当前页面为复制新增，isCopyAdd值为 "true" 字符串
        var copyFlag = '${isCopyAdd}';
        var copiedProdCode = '';
		$(document).ready(function() {
            if (copyFlag == 'true') {
                copiedProdCode = '${copiedProdCode}';
            }
			loadDiscountType();//加载"折扣系数"下拉列表
			var $inputForm = $("#inputForm");
			var $prodInstCode = $("#prodInstCode");
			var $maxDays = $("#maxDays");
			var $minDays = $("#minDays");
			var $unitPp = $("#unitPp");
			var $tradAppType = $("#tradAppType");
			var $instant = $("#instant");
			var $maxDelayDay = $("#maxDelayDay");
			var $minDelayDay = $("#minDelayDay");
			var $tradProdDesc = $("#tradProdDesc");
			var $status = $("#status");
			var $longestCancelDay =$("#longestCancelDay");
			var $pjfee =$("#pjfee");
			var $isSocial =$("#isSocial");
			var $isSuppleCare =$("#isSuppleCare");
			var $isByStaged =$("#isByStaged");
			var $isInternetClause = $("#isInternetClause");

			//加载时 给select 选中状态
			$("#poolType").find("option[value='${product.poolType}']").attr("selected",true);
			$("#prodType").find("option[value='${product.prodType}']").attr("selected",true);
			$("#PPP_UNIT").find("option[value='${product.pppUnit}']").attr("selected",true);
			$("#tradAppType").find("option[value='${product.appType}']").attr("selected",true);
            if (copyFlag != 'true'){
                $("#prodType").attr("disabled","disabled");
			    $("#tradAppType").attr("disabled","disabled");
            }
			$("#status").find("option[value='${product.status}']").attr("selected",true);
			$("#instant").find("option[value='${product.instant}']").attr("selected",true);
			$('#ageLimit').find("option[value='${product.ageLimit}']").attr("selected",true);
			$('#minAgeUnit').find("option[value='${product.minAgeUnit}']").attr("selected",true);
			$('#maxAgeUnit').find("option[value='${product.maxAgeUnit}']").attr("selected",true);
			checkLimit();
			$('#special').find("option[value='${product.special}']").attr("selected",true);
			//广西学平险增加方案类型19E6产品
			$('#planType').find("option[value='${product.planType}']").attr("selected",true);
			$('#maxOccupLevel').find("option[value='${product.maxOccupLevel}']").attr("selected",true);
			$('#insuredNoLimit').find("option[value='${product.insuredNoLimit}']").attr("selected",true);
			$('#agentType').find("option[value='${product.agentType}']").attr("selected",true);
			$("#agentType").attr("disabled","disabled");
			$('#ratiion_select').find("option[value='${product.isRation}']").attr("selected",true);
			$('#continueMaxAgeUnit').find("option[value='${product.continueMaxAgeUnit}']").attr("selected",true);
			checkInsuredNoLimit();
			//指定批减手续费选项  Y是  N否 batchReduction
			$("#isPjfee").find("option[value='${product.isPjfee}']").attr("selected",true);
			//是否分期
			$("#isByStaged").find("option[value='${product.isByStaged}']").attr("selected",true);
			//是否互联网专属条款
			$("#isInternetClause").find("option[value='${product.isInternetClause}']").attr("selected",true);
			//是否要健康告知
			$("#isInform").find("option[value='${product.isInform}']").attr("selected",true);
			checkIsPjfee();

			$("#isSocial").find("option[value='${product.isSocial}']").attr("selected",true);
			$("#isSuppleCare").find("option[value='${product.isSuppleCare}']").attr("selected",true);
			$("#payRate").find("option[value='${product.payRate}']").attr("selected",true);
			$("#waitStage").val(waitStage);
			$("#yearDeductible").val(yearDeductible);
			$("#payRate").val(payRate);
			$("#claimLimit").val(claimLimit);
			$("#graceStage").val(graceStage);
			$("#isInternetClause").css("background-color", '#ccc');
			if($('#ratiion_select').val()=='Y'){
				$("#ratiion_button").attr("disabled", false);
				$("#ration_title_div").show()
				$("#rarion_list_div").show()
				$("#PREMIUM_CHECK").attr("disabled", false);
				$("#PREMIUM_CHECK").css("background-color", 'white');
				$('#PREMIUM_CHECK').find("option[value='${product.premiumCheck}']").attr("selected",true);

			}else{
				$("#ratiion_button").attr("disabled", true);
				$("#ration_title_div").hide()
				$("#rarion_list_div").hide()
				$("#PREMIUM_CHECK").attr("disabled", true);
				$("#PREMIUM_CHECK").css("background-color", '#ccc');
				$('#PREMIUM_CHECK').val("")
			}
			if (copyFlag == "true") {
				$("#ratiion_button").attr("disabled", true);
				$("#ration_title_div").hide()
				$("#rarion_list_div").hide()
			}
			$("#epolicyCode").val(tradprodprop)
			//最长注销天数
			$longestCancelDay.change(function(){
				if($longestCancelDay.val()!=""){
					var minDelayDayReg = new RegExp("^(0|[1-9][0-9]*)$");
					var delayflag = minDelayDayReg.test($longestCancelDay.val());
					if(!delayflag) $.message("error","最长注销天数必须是大于等于0的整数");
				}
			});

			//最短延时起保时间：不小于0的整数，且首位非0
			$minDelayDay.change(function(){
				if($minDelayDay.val()!=""){
					var minDelayDayReg = new RegExp("^(0|[1-9][0-9]*|-[1-9][0-9]*)$");
					var delayflag = minDelayDayReg.test($minDelayDay.val());
					if(!delayflag) $.message("error","最短延时起保时间必须是整数");
				}
			});

			//最长延时起保时间：不小于0的整数，且首位非0
			$maxDelayDay.change(function(){
				if($maxDelayDay.val()!=""){
					var maxDelayDayReg = new RegExp("^(0|[1-9][0-9]*)$");
					var delayflag = maxDelayDayReg.test($maxDelayDay.val());
					if(!delayflag){
						$.message("error","最长延时起保时间必须是不小于0的整数");
						return;
					}
					if(parseInt($minDelayDay.val())>parseInt($maxDelayDay.val())){
						$.message("error","最长延时起保时间不能小于延时起保天数");
						return;
					}
				}
			});;

			//最短保险天数：大于等于1的正整数
			$minDays.change(function(){
				if($minDays.val()!=""){
					var minDayReg = new RegExp("^[1-9][0-9]*$");
					var minDayflag = minDayReg.test($minDays.val());
					if(!minDayflag) $.message("error","最短保险天数必须是不小于1的整数");
				}
			});

			//最长保险天数：大于等于1的正整数，且必须大于最短保险天数
			$maxDays.change(function(){
				if($maxDays.val()!=""){
					var maxDayReg = new RegExp("^[1-9][0-9]*$");
					var maxDayflag = maxDayReg.test($maxDays.val());
					if(!maxDayflag) $.message("error","最长保险天数必须是不小于1的整数");
					if(parseInt($minDays.val())>parseInt($maxDays.val())){
						$.message("error","最长保险天数不能小于最短保险天数");
					}
				}
			});

			//最大份数：不小于0的整数，且首位非0
			$unitPp.change(function(){
				if($unitPp.val()!=""){
					var unitPpReg = new RegExp("^(0|[1-9][0-9]*)$");
					var ppflag = unitPpReg.test($unitPp.val());
					if(!ppflag) $.message("error","最大份数必须是不小于0的整数");
				}
			});
			//指定批减手续费 选项  Y是  N否（当选Y时显示一个输入框，可以输入0至1之间小数（此输入框是批减扣除手续费比例字段，不输入时默认为0）） 俩字段都是非必填选项
			$pjfee.change(function(){
				var pjfee = $pjfee.val();
				if(pjfee != ""){
					var pjfeeReg = new RegExp("^0\.[0-9]*[1-9][0-9]*$");
					var flag = pjfeeReg.test(pjfee);
					if(!flag) $.message("error","批减扣除手续费必须是0至1之间小数");
				}
			});
		});

		/*-----------------------------2015年6月5日10:07:57-----wangyan------add↓---*/
		//获取折扣系数选项
		function loadDiscountType(){
			$.ajax({
				url : "product/getDiscountType",
				type : 'POST',
				async : true,
				dataType:'json',
				success:function(discountTypeList){
					if($.validate(discountTypeList))return;
					if(null!=discountTypeList && discountTypeList[0]!=undefined){
						$.each(discountTypeList,function(i,item){
							$("#adjust").append("<option value="+item.ADJUSTID+">"+item.ADJUSTDESC+"</option>");
						});
						if('${product.adjustStr}'!=""){
							var obj= $.parseJSON('${product.adjustStr}')
							if(obj.adjustId!=undefined){
								$("#adjust").find("option[value="+obj.adjustId+"]").attr("selected",true);
							}
							if(obj.adjustList!=undefined){
								for(var i=1;i<obj.adjustList.length;i++){
									addAdjustDiv();
								}
								$("#adjustDiv").find("div").each(function(i){
									$(this).find("input[type='text']").each(function(){
										if($(this).attr("name")=="peoplenum"){
											$(this).val(obj.adjustList[i].cond1);
										}
										if($(this).attr("name")=="coefficient"){
											$(this).val(obj.adjustList[i].premRate*100);
										}
									});
								});
							}
						}else{
							$("#adjustDiv").find("input[type='text']").each(function(){
								$(this).attr('readOnly',true);
								$(this).css('background-color','#ccc');
							});
						}
					}
				}
			});
		}
		function addAdjustDiv(){
			var adjustVal = $("#adjust").val()
			if(adjustVal!=""){
				$("#adjustDiv").append("<div>"+
						"<input name='peoplenum' type='text' style='width:55px;' class='input_text'>&nbsp;人&nbsp;<input name='coefficient' type='text'  style='width:55px;' class='input_text'>&nbsp;%&nbsp;&nbsp;<input type='button'  value='-' onclick='removeAdjustDiv(this)'>"
						+"</div>");
			}
		}
		function removeAdjustDiv(o){
			$(o).parent().remove()
		}
		/*-----------------2015年6月5日10:07:57------wangyan-----add↑-----*/


		//表单校验
		function checkFormFormate(){
			var $prodInstCode = $("#prodInstCode");
			var $prodInstName = $("#prodNme");
			var $prodCode = $("#prodCode");
			var $tradProdDesc = $("#tradProdDesc");
			var $tradAppType = $("#tradAppType");
			var $prodType = $("#prodType");
			var $unitPp = $("#unitPp");
			var $maxDelayDay = $("#maxDelayDay");
			var $minDelayDay = $("#minDelayDay");
			var $instant = $("#instant");
			var $minDays = $("#minDays");
			var $maxDays = $("#maxDays");
			var $pppUnit = $("#PPP_UNIT");
			var $limit = $("#ageLimit");
			var $minAge = $("#minAge");
			var $maxAge = $("#maxAge");
			var $minAgeUnit = $("#minAgeUnit");
			var $maxAgeUnit = $("#maxAgeUnit");
			var $maxOccupLevel=$("#maxOccupLevel");
			var $insuredNoLimit=$("#insuredNoLimit");
			var $minInsuredNo= $("#minInsuredNo");
			var $longestCancelDay =$("#longestCancelDay");
			if($.trim($prodInstCode.val()).length==0){
				$.message("error","请选择产品模板");
				$prodInstCode.focus();
				return false;
			}
			//产品模板名称
			if($.trim($prodInstName.val()).length==0){
				$.message("error","产品模板名称不能为空");
				$prodInstName.focus();
				return false;
			}
			if($.trim($prodCode.val()).length==0 && copyFlag != 'true'){
				$.message("error","个团标示不能为空");
				$prodCode.focus();
				return false;
			}
			//交易系统投保类型
			$tradAppType.val('${product.appType}');
			if($.trim($tradAppType.val()).length==0){
				$.message("error","交易系统投保类型不能为空");
				$tradAppType.focus();
				return false;
			}
			//产品类型
            if (copyFlag != "true"){
                $prodType.val('${product.prodType}');
            }
			if($prodType.val()==0){
				$.message("error","请选择产品类型");
				$prodType.focus();
				return false;
			}

			//最长注销天数:只能填入大于等于0的整数，默认为0.
			if($.trim($longestCancelDay.val()).length=0){
				$.message("error","请输入最长注销天数");
				$longestCancelDay.focus();
				return false;
			}else{
				//alert($longestCancelDay.val());
				var minDelayDayReg = new RegExp("^(0|[1-9][0-9]*)$");
				var delayflag = minDelayDayReg.test($longestCancelDay.val());
				if(!delayflag){
					$.message("error","最长注销天数必须是不小于0的整数")
					$longestCancelDay.focus();
					return false;
				}
			}

			//最短延时起保时间：不小于0的整数，且首位非0
			if($.trim($minDelayDay.val()).length==0){
				$.message("error","请输入最短延时起保时间");
				$minDelayDay.focus();
				return false;
			}else{
				var minDelayDayReg = new RegExp("^(0|[1-9][0-9]*|-[1-9][0-9]*)$");
				var delayflag = minDelayDayReg.test($minDelayDay.val());
				if(!delayflag){
					$.message("error","最短延时起保时间必须是整数");
					$minDelayDay.focus();
					return false;
				}
			}
			//最长延时起保时间：不小于0的整数，且首位非0
			if($.trim($maxDelayDay.val()).length==0){
				$.message("error","请输入最长延时起保时间");
				$maxDelayDay.focus();
				return false;
			}else{
				var maxDelayDayReg = new RegExp("^(0|[1-9][0-9]*)$");
				var delayflag = maxDelayDayReg.test($maxDelayDay.val());
				if(!delayflag){
					$.message("error","最长延时起保时间必须是不小于0的整数");
					$maxDelayDay.focus();
					return false;
				}
				if(parseInt($minDelayDay.val())>parseInt($maxDelayDay.val())){
					$.message("error","最长延时起保时间不能小于最短延时起保时间");
					$maxDelayDay.focus();
					return false;
				}
			}
			//最小保险期间：大于等于1的正整数
			if($.trim($minDays.val()).length==0){
				$.message("error","请输入最小保险期间");
				$minDays.focus();
				return false;
			}else{
				var minDayReg = new RegExp("^[1-9][0-9]*$");
				var minDayflag = minDayReg.test($minDays.val());
				if(!minDayflag){
					$.message("error","最小保险期间必须是不小于1的整数");
					$minDays.focus();
					return false;
				}
			}
			//最大保险期间：大于等于1的正整数，且必须大于最小保险期间
			if($.trim($maxDays.val()).length==0){
				$.message("error","请输入最大保险期间");
				$maxDays.focus();
				return false;
			}else{
				var maxDayReg = new RegExp("^[1-9][0-9]*$");
				var maxDayflag = maxDayReg.test($maxDays.val());
				if(!maxDayflag){
					if($maxDays.val()!=0){
						$.message("error","最大保险期间必须是不小于1的整数");
						$maxDays.focus();
						return false;
					}
				}
				if(parseInt($minDays.val())>parseInt($maxDays.val())){
					$.message("error","最大保险期间不能小于最小保险期间");
					$maxDays.focus();
					return false;
				}
			}
			//销售类型校验  2015年7月15日09:09:58
			var $agentType= $("#agentType");
			$agentType.val('${product.agentType}');
			if($agentType.val()==""){
				$.message("error","请选择销售类型");
				$agentType.focus();
				return false;
			}
			//如果“共保选项”是“保单级共保”，则必须输入“共保份额”
			var $poolType = $.trim($("#poolType").val());
			if($poolType.length==0){
				$.message("error","请选择共保选项");
				return false;
			}
			//即时投保限制
			if($.trim($instant.val()).length==0){
				$.message("error","即时投保限制不能为空");
				$instant.focus();
				return false;
			}

			//是否限制投保年龄
			if($limit.val()==""){
				$.message("error","请选择投保年龄限制");
				$limit.focus();
				return false;
			}else{
				var minageVal = $.trim($minAge.val());
				var maxageVal = $.trim($maxAge.val());
				var minageUnitVal = $.trim($minAgeUnit.val());
				var maxageUnitVal = $.trim($maxAgeUnit.val());
				if($limit.val()=="Y"){
					if(minageVal==""){
						$.message("error","请输入最低年龄");
						$minAge.focus();
						return false;
					}
					if(maxageVal==""){
						$.message("error","请输入最高年龄");
						$maxAge.focus();
						return false;
					}
					if(minageUnitVal==""){
						$.message("error","请选择最低年龄单位");
						$minageUnitVal.focus();
						return false;
					}
					if(maxageUnitVal==""){
						$.message("error","请选择最高年龄单位");
						$maxageUnitVal.focus();
						return false;
					}
					var regAge = /^([1-9]\d{0,2}|0)$/;
					if(!regAge.test(minageVal)){
						$.message("error","被保人年龄请输入0-999的整数");
						$minAge.focus();
						return false;
					}
					if(!regAge.test(maxageVal)){
						$.message("error","被保人年龄请输入0-999的整数");
						$maxAge.focus();
						return false;
					}

					if(minageUnitVal=="y" && maxageUnitVal=="d"){
						$.message("error","最低年龄单位不能大于最高年龄单位");
						return false;
					}else if(minageUnitVal=="d" && maxageUnitVal=="y"){
						if((Number(minageVal)/366)>Number(maxageVal)){
							$.message("error","最低年龄不能大于最高年龄");
							return false;
						}
					}else{
						if(Number(minageVal)>Number(maxageVal)){
							$.message("error","最低年龄不能大于最高年龄");
							return false;
						}
					}
				}
			}
			//是否限制最低投保人数
			if($insuredNoLimit.val()==""){
				$.message("error","请选择最低投保人数限制");
				$insuredNoLimit.focus();
				return false;
			}else{
				var minInsuredNo = $.trim($minInsuredNo.val());
				if($insuredNoLimit.val()=="Y"){
					if(minInsuredNo==""){
						$.message("error","请输入最低投保人数");
						$minInsuredNo.focus();
						return false;
					}else{
						var regMinAge = /^([1-9]\d{0,2}|0)$/;
						if(!regMinAge.test(minInsuredNo)){
							$.message("error","请输入0-999的整数");
							$minAge.focus();
							return false;
						}
					}
				}
			}
			//最大份数：不小于0的整数，且首位非0
			if($.trim($unitPp.val()).length==0){
				$.message("error","请输入最大份数");
				$unitPp.focus();
				return false;
			}else{
				var unitPpReg = new RegExp("^(0|[1-9][0-9]*)$");
				var ppflag = unitPpReg.test($unitPp.val());
				if(!ppflag){
					$.message("error","最大份数必须是不小于0的整数");
					$unitPp.focus();
					return false;
				}
			}
			//批减手续费 选项  Y是  N否（当选Y时显示一个输入框，可以输入0至1之间小数（此输入框是批减扣除手续费比例字段，不输入时默认为0）） 俩字段都是非必填选项
			pjfee = $("#pjfee").val();
			if($("#isPjfee").val() == 'Y'&& pjfee != ""){
				var pjfeeReg = new RegExp("^0\.[0-9]*[1-9][0-9]*$");
				var flag = pjfeeReg.test(pjfee);
				if(!flag){
					$.message("error","批减扣除手续费必须是0至1之间小数");
					$("#pjfee").focus();
					return false;
				}
			}
			//广西学平险增加方案类型不能为空
			var $special = $("#special");
			var $planType = $("#planType");
			if(riskMainType=='1' && $special.val()=="A2" && $.trim($planType.val()).length==0){
				$.message("error","广西学平险增加方案类型不能为空");
				$planType.focus();
				return false;
			}
			return true;
		}

		//添加产品
		function addProduct(){
			if(!checkFormFormate())return;
			var $prodInstCode = $("#prodInstCode");
			var $prodInstName = $("#prodNme");
			var $tradProdDesc = $("#tradProdDesc");
			var $tradAppType = $("#tradAppType");
			var $unitPp = $("#unitPp");
			var $maxDelayDay = $("#maxDelayDay");
			var $minDelayDay = $("#minDelayDay");
			var $instant = $("#instant");
			var $minDays = $("#minDays");
			var $maxDays = $("#maxDays");
			var $PPP_UNIT = $("#PPP_UNIT");
			var $status = $("#status");
			var $prodType = $("#prodType");
			var $poolType = $("#poolType");
			var $limit = $("#ageLimit");
			var $minAge = $("#minAge");
			var $maxAge = $("#maxAge");
			var $minAgeUnit = $("#minAgeUnit");
			var $maxAgeUnit = $("#maxAgeUnit");
			var $maxOccupLevel=$("#maxOccupLevel");
			var $insuredNoLimit=$("#insuredNoLimit");
			var $minInsuredNo= $("#minInsuredNo");
			var $agentType= $("#agentType");
			var longestCancelDay_val=$("#longestCancelDay").val();
			var tradProdDesc_val=$tradProdDesc.val();
			var tradAppType_val=$tradAppType.val();
			var prodInstCode_val=$prodInstCode.val();
			var instant_val=$instant.val();
			var maxDelayDay_val=$maxDelayDay.val();
			var minDelayDay_val=$minDelayDay.val();
			var minDays_val=$minDays.val();
			var maxDays_val=$maxDays.val();
			var PPP_UNIT_val=$PPP_UNIT.val();
			var unitPp_val=$unitPp.val();
			var status_val=$status.val();
			var prodType_val=$prodType.val();
			var poolType_val = $poolType.val();
			var limit_val=$limit.val();
			var minage_val = $minAge.val();
			var maxage_val = $maxAge.val();
			var minAgeUnit_val = $minAgeUnit.val();
			var maxAgeUnit_val = $maxAgeUnit.val();
			var maxOccupLevel_val=$maxOccupLevel.val();
			var insuredNoLimit_val=$insuredNoLimit.val();
			var minInsuredNo_val= $minInsuredNo.val();
			var agentType_val= $agentType.val();
			var special=$('#special').val();
			var planType = $("#planType").val();
			var isSocial=$('#isSocial').val();
			var isSuppleCare=$('#isSuppleCare').val();
			var waitStage=$('#waitStage').val();
			var yearDeductible=$('#yearDeductible').val();
			var payRate=$('#payRate').val();
			var claimLimit=$('#claimLimit').val();
			var graceStage=$('#graceStage').val();
			/* 抗癌保 新增字段 */
			var coPayRate='';
			var isCityIllness='';
			//最短延时起保时间单位
			var minDelayUnit = $("#minDelayUnit").val();
			//续保到...
			var continueMaxAge = $("#continueMaxAge").val();
			var continueMaxAgeUnit = $("#continueMaxAgeUnit").val();
			//判断时间合法
			if(isNaN(continueMaxAge)){
				$.message("error","续保时间应为数字");
				return;
			}
			var epolicyCode=$("#epolicyCode").val();
			var epolicyTitle=$("#epolicyTitle").val();
			/**电子保单标题为空则使用产品名称**/
			if(epolicyCode!=''&&epolicyTitle==''){
				epolicyTitle=tradProdDesc_val;
			}

			//是否分期
			var isByStaged = $("#isByStaged").val();
			//是否互联网专属条款
			var isInternetClause = $("#isInternetClause").val();
			//批减是否扣除手续费
			var isPjfee = $("#isPjfee").val();
			/*当批减是否扣除手续费为'Y',并且pjfee没有填值时,pjfee设置为0
            此时的处理逻辑是: 当isPjfee为空时(既不是Y也不是N),pjfee为空值,否则pjfee均有值,要么是0-1之间的小数,要么是0*/
			if((isPjfee == 'Y' && pjfee == "") || isPjfee == 'N'){
				pjfee = 0;
			}else if(isPjfee == ''){
				pjfee = "";
			}
			/*-----------------2015年6月5日10:42:18-----wangyan------add↓---*/
			/* 	var adjustObj = new Object();
                adjustObj.adjustId =$("#adjust").val();
                var adjustLis = [];
                $("#adjustDiv").find("div").each(function(){
                    var adjust = new Object();
                    $(this).find("input[type='text']").each(function(){
                        if($(this).attr("name")=="peoplenum"){
                            adjust.peoplenum=$(this).val();
                        }
                        if($(this).attr("name")=="coefficient"){
                            adjust.coefficient=$(this).val();
                        }
                    });
                    adjustLis.push(adjust);
                });
                adjustObj.adjustList= adjustLis;
                var adjustStr_val = JSON.stringify(adjustObj); */
			/*-----------------2015年6月5日10:42:18------wangyan-----add↑-----*/
			/*--------------------新增多保障计划开始----------------------------*/

			var html = $("#ration_table_tboday").html()
			var isRation = $("#ratiion_select").val();
			var premiumCheck=$("#PREMIUM_CHECK").val();
			if ("Y" == isRation) {
				if (html.replace(/\s+/g, "") == "") {
					$.message("error", "保障计划不能为空");
					return;
				}
			}
			if(isRation=='Y'&&premiumCheck==""){
				$.message("error","保费校验不能为空");
				return;
			}
			/* 		var rationArr = [];
                    var rationObj = new Object();
                    $("#ration_table").find("tbody").find("tr").each(function() {
                        var ration = new Object();
                        var tdArr = $(this).children();
                        ration.rationid = tdArr.eq(0).children()[0].innerHTML;
                        ration.rationname = tdArr.eq(1).html();
                        ration.jobLevel = tdArr.eq(2).html();
                        rationArr.push(ration);
                    })
                    rationObj.rationList = rationArr
                    var rations = JSON.stringify(rationObj); */
			var premiumCheck = $("#PREMIUM_CHECK").val();
			/*--------------------新增多保障计划结束----------------------------*/
			/* 新增是否健康告知 */
			var isInform = $("#isInform").val();

			var param = {
                copiedProdCode: copiedProdCode,
				special : special,
				prodCode : tradProdCode,
				prodName : tradProdDesc_val,
				appType : tradAppType_val,
				coreProdCode : prodInstCode_val,
				instant : instant_val,
				maxDelayDay : maxDelayDay_val,
				maxDays : maxDays_val,
				minDays : minDays_val,
				maxNumber : unitPp_val,
				status : status_val,
				prodType : prodType_val,
				poolType : poolType_val,
				ageLimit : limit_val,
				minAge : minage_val,
				maxAge : maxage_val,
				minAgeUnit:minAgeUnit_val,
				maxAgeUnit:maxAgeUnit_val,
				maxOccupLevel : maxOccupLevel_val,
				insuredNoLimit : insuredNoLimit_val,
				minInsuredNo : minInsuredNo_val,
				minDelayDay : minDelayDay_val,
				pppUnit : PPP_UNIT_val,
				longestCancelDay : longestCancelDay_val,
				epolicyTitle : epolicyTitle,
				epolicyCode : epolicyCode,
				isRation : isRation,
				premiumCheck : premiumCheck,
				minDelayUnit:minDelayUnit,
				isPjfee:isPjfee,
				pjfee:pjfee,
				planType:planType,
				riskMainType:riskMainType,
				continueMaxAge:continueMaxAge,
				continueMaxAgeUnit:continueMaxAgeUnit,
				isSocial:isSocial,
				isSuppleCare:isSuppleCare,
				waitStage:waitStage,
				yearDeductible:yearDeductible,
				payRate:payRate,
				claimLimit:claimLimit,
				graceStage:graceStage,
				isByStaged:isByStaged,
				isInform:isInform,
				isInternetClause:isInternetClause
			}
			saveTradProInst(param);
		}

		function bindredio() {
			$("input[name='radioTemple']").click(
					function() {
						$("input[name='radioTemple']").parent().parent()
								.removeClass("table_highlighter");
						$(this).parent().parent().addClass("table_highlighter");

					});
		}

		function saveTradProInst(param) {
			if (!Formstatus) {
				$.message("error", "处理中请勿重复提交");
				return;
			}
			Formstatus = false;
            // 当前为复制新增
            if (copyFlag == 'true') {
                copyAddSaveTradProInst(param);
                return;
            }
			$.openLoading();
			$.ajax({
				url : "nlifeProductConfig/updateNewLifeProdInfo",
				type : 'POST',
				async : true,
				dataType : 'json',
				data : param,
				success : function(obj) {
					$.closeLoading();
					Formstatus = true;
					if ($.validate(obj))
						return;
					if ("other" == obj.result) {
						$("#status").find("option[value='0']").attr("selected",
								true);
						$.dialog({
							type : "warn",//success,error
							content : "本产品主条款定义未完成只可为[无效]状态,是否定义产品主条款?",
							onOk : function() {
								openInsurance();
								return;
							}
						});
						return;
					}
					$.dialog({
						type : "success",//success,error
						content : "产品修改成功,是否继续修改条款配置?",
						onOk : function() {
							openInsurance();
							return;
						}
					});
				}
			});
		}
        // 复制新增存储
        function copyAddSaveTradProInst(param) {
            $.openLoading();
            $.ajax({
                url : "nlifeProductConfig/saveCopyAddNlifeProduct",
                type : 'POST',
                async : true,
                dataType : 'json',
                data : param,
                success : function(obj) {
                    $.closeLoading();
                    Formstatus = true;
                    if ($.validate(obj))return;
                    tradProdCode = obj.type.prodCode;
                    $.dialog({
                        type: "success",
                        content: "产品添加成功,是否继续添加 条款配置",
                        onCancel:function(){
                            openProductList();
                            return;
                        },
                        onOk: function() {
                            openInsurance();
                            return;
                        }
                    });
                }
            })
        }

        function openProductList(){
            window.location.href='<%=basePath%>nlifeProductConfig/list';
        }

		function vreset() {
			$("#unitPp").val("");//最大份数
			$("#maxDelayDay").val("");//最长延时起保时间
			$("#minDelayDay").val("");//最短延时起保时间
			$("#minDays").val("");//保险期间最小
			$("#maxDays").val("");//保险期间最大
			$("#PPP_UNIT").val("d");//保险期间
			$("#tradProdDesc").val("");//交易系统产品描述
			$("#instant").find("option[value='N']").attr("selected", true);//是否即时投保
			$("#status").find("option[value='0']").attr("selected", true);//产品状态
			$('#poolType').val("");//共保选项
			$("#ageLimit").val("");//是否限制投保年龄
			$("#maxAge").val('');//最大年龄
			$("#minAge").val('');//最小年龄
			$("#maxAge").attr('readOnly', true);
			$("#minAge").attr('readOnly', true);
			$("#maxAge").css('background-color', '#ccc');
			$("#minAge").css('background-color', '#ccc');
			$("#maxOccupLevel").val("");//最高职业类别
			$("#insuredNoLimit").val("");//是否限制最低投保人数
			$("#minInsuredNo").val('');//最低投保人数
			$("#minInsuredNo").attr('readOnly', true);
			$("#minInsuredNo").css('background-color', '#ccc');
			$("#ratiion_select").val("N");
			$("#ratiion_button").attr("disabled", true);
			$("#ration_title_div").hide()
			$("#rarion_list_div").hide()
			$("#ration_table_tboday").html("")
			$("#PREMIUM_CHECK").val("")
			$("#PREMIUM_CHECK").attr("disabled", true);
			$("#PREMIUM_CHECK").css("background-color", '#ccc');
			//批减扣除手续费
			$("#isPjfee").val("");
			checkIsPjfee();
		}

		function openInsurance() {
			window.location.href = '<%=basePath%>nlifeProductConfig/newLifeRiskAddReq?tradProdCode='+tradProdCode;
		}
		//选择是否限制投保年龄下拉框
		function checkLimit(){
			var limitFlag = $('#ageLimit').val();
			if(limitFlag=="Y"){
				$('#minAge').attr('readOnly',false);
				$('#minAge').css('background-color','white');
				$('#maxAge').attr('readOnly',false);
				$('#maxAge').css('background-color','white');
				$("#minAgeUnit").attr("disabled", false);
				$("#minAgeUnit").css("background-color", 'white');
				$('#maxAgeUnit').attr('disabled',false);
				$('#maxAgeUnit').css('background-color','white');
				$('#continueMaxAge').attr('readOnly',false);
				$('#continueMaxAge').css('background-color','white');
				$('#continueMaxAgeUnit').attr('disabled',false);
				$('#continueMaxAgeUnit').css('background-color','white');
			}else{
				$('#minAge').attr('readOnly',true);
				$('#minAge').css('background-color','#ccc');
				$('#maxAge').attr('readOnly',true);
				$('#maxAge').css('background-color','#ccc');
				$('#minAgeUnit').attr('disabled',true);
				$('#minAgeUnit').css('background-color','#ccc');
				$('#maxAgeUnit').attr('disabled',true);
				$('#maxAgeUnit').css('background-color','#ccc');
				$('#maxAge').val('');
				$('#minAge').val('');
				$('#continueMaxAge').attr('readOnly',true);
				$('#continueMaxAge').css('background-color','#ccc');
				$('#continueMaxAgeUnit').attr('disabled',true);
				$('#continueMaxAgeUnit').css('background-color','#ccc');
				$('#continueMaxAge').val('');
			}
		}
		//选择是否限制最低投保人数下拉框
		function checkInsuredNoLimit(){
			var personFlag = $('#insuredNoLimit').val();
			if(personFlag=="Y"){
				$('#minInsuredNo').attr('readOnly',false);
				$('#minInsuredNo').css('background-color','white');
			}else{
				$('#minInsuredNo').attr('readOnly',true);
				$('#minInsuredNo').css('background-color','#ccc');
				$('#minInsuredNo').val('');
			}
		}
		//校验折扣系数
		function chectAdjust(){
			var  flag= true;
			$("#adjustDiv").find("input[type='text']").each(function(){
				if($(this).attr("name")=="peoplenum"){
					if($.trim($(this).val())==""){
						$.message("error","折扣系数:人数不能为空");
						$(this).focus();
						flag= false;
						return false;
					}else{
						var regPeopleNum = /^([1-9]\d{0,3}|0)$/;
						if(!regPeopleNum.test($(this).val())){
							$.message("error","折扣系数(人数):请输入0-9999的整数");
							$(this).focus();
							flag= false;
							return false;
						}
					}
				}else if($(this).attr("name")=="coefficient"){
					if($.trim($(this).val())==""){
						$.message("error","折扣系数:百分比不能为空");
						$(this).focus();
						flag= false;
						return false;
					}else{
						var regCoefficient = /^([1-9]\d{0,2}|0)$/;
						if(!regCoefficient.test($(this).val())){
							$.message("error","折扣系数(百分比):请输入0-999的整数");
							$(this).focus();
							flag= false;
							return false;
						}
					}
				}
			});
			return flag;
		}
		function changeAdjust(){
			var adjustVal= $("#adjust").val();
			if(adjustVal==""){
				$("#adjustDiv").empty();
				$("#adjustDiv").append("<div>"+
						"<input name='peoplenum' type='text' style='background-color: #ccc;width:55px;' readonly='readonly'  class='input_text'>&nbsp;人&nbsp;<input name='coefficient' type='text'  style='background-color: #ccc;width:55px;' readonly='readonly' class='input_text'>&nbsp;%&nbsp;&nbsp;<input type='button'  id='addSale' value='+' onclick='addAdjustDiv()'>"
						+"</div>");
			}else{
				$("#adjustDiv").find("input[type='text']").each(function(){
					$(this).attr('readOnly',false);
					$(this).css('background-color','white');
				});
			}
		}
		/*-----------------2015年6月5日10:44:25------wangyan-----add↑-----*/
		function isSocialChange(param){
			var paramValue = param.value;
			if(paramValue=="001"){
				$("#isSuppleCare").val("B2");
				$('#isSuppleCare').attr('disabled',false);
				$('#isSuppleCare').css('background-color','white');
			}else{
				$("#isSuppleCare").val("B1");
				$('#isSuppleCare').attr('disabled',true);
				$('#isSuppleCare').css('background-color','#ccc');
			}
		}
		function ratiionChange(){
			var falg= $("#ratiion_select").val();
			if("Y"==isRation && falg=="N" && editPageRiskCount!=0){
				$.message("error","保障计划已关联条款，请先删除条款");
				$("#ratiion_select").val("Y");
				return;
			}
			if(falg=="Y"){
				$("#ratiion_button").attr("disabled", false);
				$("#PREMIUM_CHECK").attr("disabled", false);
				$("#PREMIUM_CHECK").css("background-color", 'white');
				$("#ration_title_div").show()
				$("#rarion_list_div").show()
			}else{
				$("#ratiion_button").attr("disabled", true);
				$("#PREMIUM_CHECK").attr("disabled", true);
				$("#PREMIUM_CHECK").css("background-color", '#ccc');
				$("#PREMIUM_CHECK").val("");
				$("#ration_title_div").hide()
				$("#rarion_list_div").hide()
				$("#ration_table_tboday").html("")
			}
		}
		function ratiionClick(){
			var selectOptions="";
			for (var i=0;i<levelUpArr.length;i++){
				selectOptions+="<option value='"+levelUpArr[i]+"'>"+levelUpArr[i]+"类</option>"
			}
			var tdStrs="";
			for(var i=1;i<=2;i++){
				var tdStr="";
				for(var j=1;j<=4;j++){
					if(j==1){
						tdStr+="<tr><td><span>"+i+"</span></td>"
					}else if(j==2){
						tdStr+="<td><input id='rationName"+i+"' type='text' style='width:100%;' class='input_text'></td>"
					}else if(j==3){
						tdStr+="<td><select id='level_up"+i+"' style='width: 100%;height: 23px;' class='input_text' onchange='levelUpChange(this)'><option value=''></option>"+selectOptions+"</select></td>"
					}else if(j==4){
						tdStr+="<td><select id='level_down"+i+"' style='width: 100%;height: 23px;' class='input_text' ></select></td></tr>"
					}
				}
				tdStrs+=tdStr;
			}
			var tableObj = $("#rationTable");
			tableObj.find("tbody").remove();
			tableObj.append(tdStrs);
			$("#addProdRationDiv").OpenDiv6();
		}
		function addLine(){
			var numberLine =parseInt($("#rationTable tr:last").find('td').children()[0].innerHTML)+1;
			var tdStr="";
			var selectOptions="";
			for (var i=0;i<levelUpArr.length;i++){
				selectOptions+="<option value='"+levelUpArr[i]+"'>"+levelUpArr[i]+"类</option>"
			}
			tdStr+="<tr><td><span>"+numberLine+"</span></td>"+"<td><input id='rationName"+numberLine+"' type='text' style='width:100%;' class='input_text'></td>"+"<td><select id='level_up"+numberLine+"' style='width: 100%;height: 23px;' class='input_text' onchange='levelUpChange(this)'><option value=''></option>"+selectOptions+"</select></td>"+"<td><select id='level_down"+numberLine+"' style='width: 100%;height: 23px;' class='input_text' ></select></td></tr>"
			$("#rationTable").find("tbody").append(tdStr)
		}

		function saveRation() {
			$.openLoading();
			var numberLine = parseInt($("#rationTable tr:last").find('td').children()[0].innerHTML);
			for (var i = 1; i <= numberLine; i++) {
				var rationName = $("#rationName" + i).val();
				var level_up = $("#level_up" + i).val();
				var level_down = $("#level_down" + i).val();
				if (rationName == "") {
					$.message("error", "第" + i + "行保障计划名称不能为空");
					return;
				}
				if (level_up == "") {
					$.message("error", "第" + i + "行职业级别不能为空");
					return;
				}
				if (level_down == "") {
					$.message("error", "第" + i + "行职业级别不能为空");
					return;
				}
			}
			var rationListTableLine
			var tableObj = $("#ration_table");
			var count = $("#ration_table").find("tbody").find("tr");
			var prodCode = $("#prodCode").val();
			if (count.length == 0) {
				rationListTableLine = 1
			} else {
				rationListTableLine = parseInt($("#ration_table tr:last")
						.find('td').children()[0].innerHTML) + 1;
			}
			var lastbutton = "<td><a href='javascript:void(0)' onclick='editLine(this);return false'>编辑</a>&nbsp;&nbsp;"
					+ "<a href='javascript:void(0)' onclick='deleteLine(this);return false'>删除</a></td>"
			var tdStrs = ""
			var rationObj = new Object();
			var rationArr = [];
			for (var i = 1; i <= numberLine; i++) {
				var rationName = $("#rationName" + i).val()
				var jobLevel = $("#level_up" + i).val() + "-"
						+ $("#level_down" + i).val();

				var ration = new Object();
				ration.rationid = rationListTableLine;
				ration.rationname = rationName;
				ration.jobLevel = jobLevel;
				rationArr.push(ration);

				var tdStr = ""
				tdStrs += "<tr><td><span id='rationId"+rationListTableLine+"'>"
						+ rationListTableLine + "</span></td>" + "<td>"
						+ rationName + "</td><td style='display:none'>" + jobLevel
						+ "</td><td>" + jobLevel
						+ "类</td><td style='display: none;'>N</td>" + lastbutton
						+ "</tr>";
				rationListTableLine++
			}
			rationObj.rationList = rationArr
			var rations = JSON.stringify(rationObj);
			$.ajax({
				url : "nlifeProductConfig/addRationInfo",
				type : 'POST',
				async : true,
				dataType : 'json',
				data : {prodCode : prodCode,rations : rations,isRation : isRation},
				success : function(obj) {
					if ($.validate(obj))return;
					$.closeLoading();
				}
			});
			$("#ration_table").find("tbody").append(tdStrs)
			$("#addProdRationDiv").CloseDiv();
		}
		function deleteLine(param) {
			$.openLoading();
			var flag = $(param).parent().parent().children("td:eq(4)").html();
			var prodCode = $("#prodCode").val();
			var rationId = $(param).parent().parent().children("td:eq(0)")
					.children()[0].innerHTML
			if ("Y" == flag) {
				$.message("error", "该保障计划已经关联条款，请先删除条款信息");
				$.closeLoading();
				return;
			}
			$.ajax({
				url : "nlifeProductConfig/deleteRationInfo",
				type : 'POST',
				async : true,
				dataType : 'json',
				data : {
					prodCode : prodCode,
					rationId : rationId
				},
				success : function(obj) {
					if (obj.result == "success") {
						$.message("success", "删除成功");
						$(param).parent().parent().remove();
					} else {
						$.message("error", obj.message);
					}
					$.closeLoading();
				}
			});
		}
		function editLine(data) {
			var id = $(data).parent().parent().children("td:eq(0)").children()[0].innerHTML
			var rationName = $("#rationId" + id).parent().parent().children(
					"td:eq(1)").html();
			var jobLevel = $(data).parent().parent().children("td:eq(2)").html();
			var levelArr = jobLevel.split("-")
			$("#editLevelUp").val(levelArr[0])
			var editLevelDownOption = "";
			for (var i = levelArr[0]; i <= 6; i++) {
				editLevelDownOption += "<option value = '"+i+"'>" + i
						+ "类</option>"
			}
			$("#editLevelDown").html(editLevelDownOption);
			$("#editLevelDown").val(levelArr[1]);
			$("#editRationId").text(id);
			$("#editRationName").val(rationName);
			$("#editRationDiv").OpenDiv();

		}
		function EditSave() {
			$.openLoading();
			var id = $("#editRationId").html();
			var editRationName = $("#editRationName").val();
			var editLevelUp = $("#editLevelUp").val() + "-"
					+ $("#editLevelDown").val();
			$("#rationId" + id).parent().parent().children("td:eq(1)").html(
					editRationName);
			$("#rationId" + id).parent().parent().children("td:eq(2)").html(
					editLevelUp);
			$("#rationId" + id).parent().parent().children("td:eq(3)").html(
					editLevelUp + "类");
			$.ajax({
				url : "nlifeProductConfig/updateRationInfo",
				type : 'POST',
				async : true,
				dataType : 'json',
				data : {
					prodCode : tradProdCode,
					rationId : id,
					rationName : editRationName,
					jobLevel : editLevelUp
				},
				success : function(obj) {
					$("#editRationDiv").CloseDiv();
					$.closeLoading();
					$.message("success", "修改成功");
				}
			});
		}
		function levelUpChange(param) {
			var id = $(param).parent().parent().find('td').children()[0].innerHTML
			var selectValue = $("#level_up" + id).val();
			var levelDownOption = "";
			for (var i = selectValue; i <= 6; i++) {
				levelDownOption += "<option value = '"+i+"'>" + i + "类</option>"
			}
			$("#level_down" + id).html(levelDownOption);
		}
		function editSelectChange() {
			var selectValue = $("#editLevelUp").val();
			var editLevelDownOption = "";
			for (var i = selectValue; i <= 6; i++) {
				editLevelDownOption += "<option value = '"+i+"'>" + i
						+ "类</option>"
			}
			$("#editLevelDown").html(editLevelDownOption);
		}
		function closeProdRationDiv() {
			$("#addProdRationDiv").CloseDiv();
		}
		function closeEditRationDiv() {
			$("#editRationDiv").CloseDiv();
		}

		//批减是否扣除手续费
		function checkIsPjfee(){
			var flag = $("#isPjfee").val();
			if(flag=="Y"){
				$('#pjfeeTH').show();
				$('#pjfeeTD').show();
				$('#pjfeeTD').next().hide();
				if(pjfee == '0') $('#pjfee').val("");
				else $('#pjfee').val(pjfee)
			}else{
				$('#pjfeeTH').hide();
				$('#pjfeeTD').hide();
				$('#pjfeeTD').next().show();
				pjfee = "";
				$('#pjfee').val(pjfee);
			}
		}
		function loadSpecialAttr(instCode){
			$.ajax({
				url : "nlifeProductConfig/getSpecialAttr",
				type : 'POST',
				async : true,
				dataType:'json',
				data:{
					instCode:instCode,
					prodCode:'${product.prodCode}'
				},
				success:function(specialAttrList){
					$('#templateId_tboday').html('');
					var content = '';
					if (specialAttrList!=null && specialAttrList.length > 1) {
						content += "<tr><th>个性产品录入字段</th><td colspan='3'></td></tr><tr>";
						for (var i = 1; i < specialAttrList.length; i++) {
							var product = JSON.parse(specialAttrList[0].nlifeProd);
							content+= "<th>"+specialAttrList[i].dict.codeName+"：</th>"
							specialCodeName.push(specialAttrList[i].dict.code);
							if (specialAttrList[i].dict.otherCode=='select') {
								if (specialAttrList[i].dict.code=='isSocial') {
									content+="<td><select id='"+specialAttrList[i].dict.code+"' class='select_1' style='visibility: visible;width:100px;' onchange='isSocialChange(this)'>"
								}else{
									content+="<td><select id='"+specialAttrList[i].dict.code+"' class='select_1' style='visibility: visible;width:100px;' >"
								}
								var dictNames=specialAttrList[i].dictSelect;
								for (var j = 0; j < dictNames.length; j++) {
									if(dictNames[j].code==eval("product."+specialAttrList[i].dict.code))
										content+="<option value='"+dictNames[j].code+"' selected>"+dictNames[j].codeName+"</option>";
									else
										content+="<option value='"+dictNames[j].code+"'>"+dictNames[j].codeName+"</option>";
								}
								content+="</select></td>"
							}else if(specialAttrList[i].dict.otherCode=='text'){
								content+="<td><input type='text' class='input_text' id='"+specialAttrList[i].dict.code+"' value='"+eval("product."+specialAttrList[i].dict.code)+"'></td>"
							}
							if (specialAttrList[i].dict.code=='securityplan') {
								content+="<td><select id='"+specialAttrList[i].dict.code+"' class='select_1' style='visibility: visible;width:100px;' ><option value=''>---请选择---</option>";
								var securityplan = specialAttrList[i].securityplan;
								for (var j = 0; j < securityplan.length; j++) {
									if (securityplan[j].otherCode==specialAttrList[i].dict.otherCode) {
										if(securityplan[j].code==eval("product."+specialAttrList[i].dict.code))
											content+="<option value='"+securityplan[j].code+"' selected>"+securityplan[j].codeName+"</option>";
										else
											content+="<option value='"+securityplan[j].code+"'>"+securityplan[j].codeName+"</option>";
									}
								}
							}
							if (i%2==0) {
								content+="</tr><tr>";
							}
						}
					}
					$('#special_tboday').html(content);
				}
			});
			//$('#isSocial').find("option[value='${product.isSocial}']").attr("selected",true);
		}
	</script>
</head>
<body>
<div class="right">
	<div class="current">
		<table class="current_table_1">
			<tbody><tr>
				<td><img src="./images/current_1.jpg"></td>
				<td class="current_table_1_td"><img src="images/current_1.png">&nbsp;您现在的位置：&nbsp;
					<span style=" color:#136bab; ">新意健险产品管理
	                  <span style="padding:0 5px; font-weight:bold; line-height:28px;">&gt;</span>产品配置
	                  <span style="padding:0 5px; font-weight:bold; line-height:28px;">&gt;</span>编辑产品
	                  </span>
				</td>
				<td><img src="./images/current_3.jpg"></td>
			</tr>
			</tbody>
		</table>
	</div>

	<form id="inputForm" >
		<table class="table_05">
			<tbody>
			<tr>
				<td colspan="4" style=" font-size:12px; font-weight:bold; text-align:left;color:#3876bf; line-height:17px; background-image:url(images/centent_1.jpg)">编辑产品</td>
			</tr>
			<tr>
				<th width="22%">产品模板代码：</th>
				<td width="25%">
					<input name="prodInstCode" id="prodInstCode"  value="${product.coreProdCode}" type="text" readonly="true" style="background-color:#ccc;width:250px;" class="input_text"><span class="red">*</span>&nbsp;
				</td>
				<th width="20%">产品模板名称：</th>
				<td width="28%"><input id="prodNme" value="${product.coreProdName}" type="text" readonly="true" style="background-color:#ccc;width:250px;" class="input_text"><span class="red">*</span></td>
			</tr>
			<tr>
				<th width="25%">交易系统产品代码：</th>
				<td width="28%">
					<input name="prodCode" id="prodCode"  value="${product.prodCode}" type="text" readonly="true" style="background-color:#ccc;width:250px;" class="input_text"><span class="red">*</span>&nbsp;
				</td>
				<th>交易系统产品名称：</th>
				<td><input name="tradProdDesc" id="tradProdDesc" maxlength="100"  class="input_text" value = "${product.prodName}"  style="width:250px;"><span class="red">*</span></td>
			</tr>
			<tr>
				<th>个团标识：</th>
				<td><select name="tradAppType" id="tradAppType" class="select_1" style="visibility: visible;width:250px;"><option value="0">个单</option><option value="1">团单</option></select><span class="red">*</span></td>
			</tr>
			<tr>
				<th>最短延时起保时间：</th>
				<td><input name="minDelayDay"  id="minDelayDay" value="${product.minDelayDay}" type="text" maxlength="5" class="input_text" style="width:250px;"><span class="red">*</span>
					<span>
	                  		<select id="minDelayUnit">
	                  			<option value="d">天</option>
	                  			<option value="h">小时</option>
	                  			<option value="m">分钟</option>
	                  		</select>
	                  	</span>
					<span class="blue">支持负数</span></td>
				<th>最长延时起保时间：</th>
				<td><input name="maxDelayDay"  id="maxDelayDay" value="${product.maxDelayDay}" type="text" maxlength="5" class="input_text" style="width:250px;"><span class="red">*</span></td>
			</tr>
			<tr>
				<th>最长起保后注销天数：</th>
				<td><input name="longestCancelDay"  id="longestCancelDay" type="text" value="${product.longestCancelDay}" maxlength="5" class="input_text" style="width: 250px"><span class="red">*</span></td>
				<th>共保选项：</th>
				<td><select id="poolType" class="select_1" style="visibility: visible;width:250px;">
					<option value="">---请选择---</option>
					<c:forEach var ="polPoolTypeLs" items="${polPoolType}">
						<option value="${polPoolTypeLs.code}">${polPoolTypeLs.codeName}</option>
					</c:forEach>
				</select><span class="red">*</span></td>
			</tr>
			<tr>
				<th>保险期间：</th>
				<td>
					<input name="minDays" id="minDays" maxlength="5" value="${product.minDays}"  type="text" class="input_text" style="width:60px;">&nbsp;至&nbsp;
					<input name="maxDays" id="maxDays" maxlength="5" value="${product.maxDays}"  type="text" class="input_text" style="width:60px;">&nbsp;&nbsp;
					<select name="PPP_UNIT" id="PPP_UNIT" class="select_1"  style="width:55px;visibility: visible;">
						<c:forEach var ="insurePeriodLs" items="${insurePeriodList}">
							<option value="${insurePeriodLs.code}">${insurePeriodLs.codeName}</option>
						</c:forEach>
					</select><span class="red">*</span>
				</td>
			<tr>
				<th>是否支持即时投保：</th>
				<td><select name="instant" id="instant" class="select_1" style="visibility: visible;width:250px;"><option value="N">否</option><option value="Y">是</option></select><span class="red">*</span></td>
				<th>被保人年龄限制：</th>
				<td>
					<select id="ageLimit" onchange="checkLimit()" class="select_1" style="visibility: visible;width:80px;">
						<option value="">--请选择--</option>
						<option value="Y">是</option>
						<option value="N">否</option>
					</select><span class="red">*</span>
					<input id="minAge" type="text" value="${product.minAge}" readonly="true" style=" background-color: #ccc;width:30px;" class="input_text">
					<select id="minAgeUnit"  class="select_1" disabled="disabled" style="visibility: visible;width:60px;">
						<option value="">-选择-</option>
						<option value="y">周岁</option>
						<option value="d">天</option>
					</select>
					到
					<input id="maxAge" type="text" value="${product.maxAge}" readonly="true" style=" background-color: #ccc;width:30px;" class="input_text">
					<select id="maxAgeUnit" class="select_1" disabled="disabled" style="visibility: visible;width:60px;">
						<option value="">-选择-</option>
						<option value="y">周岁</option>
						<option value="d">天</option>
					</select>
					续保到：
					<input id="continueMaxAge" type="text"value="${product.continueMaxAge}"  style=" width:25px;" class="input_text">
					<select id="continueMaxAgeUnit" class="select_1" style="visibility: visible;width:50px;">
						<option value="">-选择-</option>
						<option value="y">周岁</option>
						<option value="d">天</option>
					</select>
				</td>
			</tr>
			<tr>
				<th>最高职业类别：</th>
				<td><select name="maxOccupLevel" id="maxOccupLevel" class="select_1" style="visibility: visible;">
					<option value="">不限制</option>
					<option value="1">1类</option>
					<option value="2">2类</option>
					<option value="3">3类</option>
					<option value="4">4类</option>
					<option value="5">5类</option>
					<option value="6">6类</option>
				</select><span class="red">*</span></td>
				<th>最低被保人数限制：</th>
				<td>
					<select id="insuredNoLimit" onchange="checkInsuredNoLimit()" class="select_1" style="visibility: visible;width:100px;">
						<option value="">----请选择----</option>
						<option value="Y">是</option>
						<option value="N">否</option>
					</select><span class="red">*</span>
					<input id="minInsuredNo" value="${product.minInsuredNo}"  type="text" readonly="true" style=" background-color: #ccc;width:55px;" class="input_text">&nbsp;人
				</td>
			</tr>
			<tr>
				<th>最大份数：</th>
				<td><input name="unitPp"  id="unitPp" value="${product.maxNumber}" type="text" maxlength="5" class="input_text"><span class="red">*</span></td>
				<th>状态：</th>
				<td><select  name="status" id="status" class="select_1" style="visibility: visible;width:250px;"><option  value="0">无效</option><option value="1">有效</option></select><span class="red">*</span></td>
			</tr>
				<!-- 	              	  <th>折扣系数：</th>
                                      <td>
                                          <div id="adjustDivLeft" style="float: left;width:135px;">
                                              <select id="adjust" onchange="changeAdjust()"  class="select_1" style="visibility: visible;width:100px;"><option value="">无</option></select><span class="red">*</span>&nbsp;&nbsp;
                                          </div>
                                          <div id="adjustDiv" style="float: left;">
                                              <div>
                                                  <input name="peoplenum" type="text" style="width:55px;" class="input_text">&nbsp;人&nbsp;<input name="coefficient" type="text"  style="width:55px;" class="input_text">&nbsp;%&nbsp;&nbsp;<input type="button"  id="addSale" value="+" onclick="addAdjustDiv()">
                                              </div>
                                          </div>
                                      </td> -->
				<th>是否多保障计划</th>
				<td>
					<select id="ratiion_select" disabled="disabled" class="select_1" style="visibility: visible;width:100px;" >
						<option value="N">否</option>
						<option value="Y">是</option>
					</select>&nbsp;
					<input id="ratiion_button" type="button"  disabled="disabled" value="保障计划录入" onclick="ratiionClick()"><span class="red">*</span>
				</td>
				<th>保费校验：</th>
				<td>
					<select id="PREMIUM_CHECK" class="select_1" style="visibility: visible;" disabled="disabled">
						<option value="">---请选择---</option>
						<option value="1">标准保费</option>
						<option value="2">最低保费</option>
					</select><span class="red">*</span>
				</td>
			</tr>
			<!-- <tr>
				<th>批减是否扣除手续费</th>
				<td>
					<select id="isPjfee" onchange="checkIsPjfee()" class="select_1" style="visibility: visible;width:100px;">
						<option value="">----请选择----</option>
						<option value="Y">是</option>
						<option value="N">否</option>
					</select>
				</td>
				<th id="pjfeeTH" style="display:none;">批减扣除手续费比例：</th>
				<td id="pjfeeTD" style="display:none;"><input name="pjfee"  id="pjfee" type="text" class="input_text" value=""></td>

				<th class='isInform' style="display:none;">是否需健康告知</th>
				<td class='isInform' style="display:none;">
					<select id="isInform" class="select_1" style="visibility: visible;width:100px;">
						<option value="N">否</option>
						<option value="Y">是</option>
					</select>
				</td>
			</tr> -->
			<tr>
				<th>是否支持分期</th>
				<td>
					<select id="isByStaged" class="select_1" style="visibility: visible;width:100px;">
						<option value="N">否</option>
						<option value="Y">是</option>
					</select>
				</td>
				<th>是否互联网专属条款</th>
				<td>
					<select id="isInternetClause" class="select_1" disabled="disabled" style="visibility: visible;width:100px;">
						<option value="N">否</option>
						<option value="Y">是</option>
					</select>
				</td>
			</tr>
			<tbody id="special_tboday">
			</tbody>
			</tbody>
		</table>
	</form>
	<!-- 多保障计划开始 -->
	<div id="ration_title_div" style="display: none;">
		<table class="ration_table_title">
			<tr>
				<td colspan="6"
					style="font-size: 12px; font-weight: bold; text-align: left; color: #3876bf; line-height: 17px; background-image: url(images/centent_1.jpg)">保障计划信息</td>
			</tr>
		</table>
	</div>
	<div id="rarion_list_div" style="display: none;overflow:scroll; width:100%; height:30%;">
		<table class="ration_table" id="ration_table">
			<thead>
			<tr>
				<th style="width: 20%;">编号</th>
				<th style="width: 40%">保障计划名称</th>
				<th style="width: 20%">职业级别</th>
				<th style="width: 10%">编辑</th>
			</tr>
			</thead>
			<tbody id="ration_table_tboday">
			<c:if test="${fn:length(rationList)>0}">
				<c:forEach items="${rationList}" var="ration">
					<tr>
						<td><span id="rationId${ration.rationId}">${ration.rationId }</span></td>
						<td>${ration.rationName }</td>
						<td style="display: none;">${ration.jobLevel }</td>
						<td>${ration.jobLevel }类</td>
						<td style="display: none;">${ration.riskFlag }</td>
						<td><a href="javascript:void(0)" onclick="editLine(this);return false">编辑</a>&nbsp;&nbsp;<a href="javascript:void(0)" onclick="deleteLine(this);return false">删除</a></td>
					</tr>
				</c:forEach>
			</c:if>
			</tbody>
		</table>
	</div>
	<div align="center">
		<input class="input_button_1" name="" type="button" value="保存" onclick="addProduct()">&nbsp;&nbsp;
		<input class="input_button_1" name="" type="button" onclick="vreset()"  value="重置">
	</div>
	<!-- 列表隐藏DIV -->
	<div id="addProdRationDiv" style="display: none; width: 90%;">
		<input type="hidden" id="row_num" name="row_num" value="0" />
		<div
				style='width: 100%; line-heighe: 20px; background-color: #A4BDE3'>
			<table class="table_title">
				<tr>
					<td width="100%" id="interfaceName"></td>
					<td width="40px" align="right"><img
							src="<%=path%>/images/closedown.gif" alt="关闭"
							onclick="closeProdRationDiv()" /></td>
				</tr>
			</table>
		</div>
		<div style="width: 100%; height: 190px; overflow: scroll;"
			 id="addDiv">
			<table class="table_02" id="addrationTable" align="center"
				   style="margin-top: 3px">
				<tbody>
				<tr>
					<td>
						<table id="rationTable" class="content_table_1">
							<thead>
							<tr class="f1">
								<th style="width: 20%;">编号</th>
								<th style="width: 40%;">保障计划名称</th>
								<th style="width: 20%;">职业级别</th>
								<th style="width: 20%;">职业级别</th>
							</tr>
							</thead>
							<tbody>
							</tbody>
						</table>
					</td>
				</tr>
				</tbody>
			</table>
			<div align="center"
				 style="position: relative; margin-top: 20px; left: auto; right: auto;">
				<input class="input_button_3" name="" type="button"
					   onclick="saveRation()" value="保存">&nbsp;&nbsp; <input
					class="input_button_3" name="" type="button"
					onclick="closeProdRationDiv()" value="取消">&nbsp;&nbsp; <input
					class="input_button_3" name="" type="button" onclick="addLine()"
					value="新增"> <input type="hidden" id="hiddenButton"
									   value="">
			</div>
		</div>
	</div>
	<!-- 编辑 -->
	<div id="editRationDiv" style="display:none;width:600px;height:200px;">
		<input type="hidden" id="row_num" name="row_num" value="0"/>
		<div class="table_title_div">
			<table class="table_title" style='width:100%;height: 20px;'>
				<tr>
					<td width="10%"></td>
					<td width="80%" id="interfaceName"></td>
					<td width="10%" align="right"><img src="<%=path %>/images/closedown.gif" alt="关闭"  onclick="closeEditRationDiv()"/></td>
				</tr>
			</table>
		</div>
		<table class="table_02" id="saveAppTable" style="height:20%;width: 95%" align="center" >
			<tr>
				<td style="text-align:right;border-right:0px;height: 10px;">编号：</td>
				<td style="text-align:left;height: 10px;"><span id="editRationId"></span></td>
			</tr>
			<tr>
				<td style="text-align:right;border-right:0px;height: 10px;">保障计划名称：</td>
				<td style="text-align:left;height: 10px;" ><input type="text" id="editRationName" class="input_text" value=""></td>
			</tr>
			<tr>
				<td style="text-align:right;border-right:0px;height: 10px;">职业级别：</td>
				<td style="text-align:left;height: 10px;" >
					<select id="editLevelUp" onchange="editSelectChange()"  class="input_text">
						<option value="1">1类</option>
						<option value="2">2类</option>
						<option value="3">3类</option>
						<option value="4">4类</option>
						<option value="5">5类</option>
						<option value="6">6类</option>
					</select>
				</td>
			</tr>
			<tr>
				<td style="text-align:right;border-right:0px;height: 10px;">职业级别：</td>
				<td style="text-align:left;height: 10px;" >
					<select id="editLevelDown"  class="input_text">

					</select>
				</td>
			</tr>
		</table>
		<div style="height:30px;width: 95%;margin-top: 30px;" align="center">
			&nbsp;&nbsp;&nbsp;&nbsp;<input type="button" id="saveBtn" value="保存" onclick="EditSave()" class="input_button_1"/>&nbsp;&nbsp;&nbsp;
			<input type="button" value="取消" onclick="closeEditRationDiv()" class="input_button_1"/>
		</div>
	</div>
	<!-- 多保障计划结束 -->
</div>
</body>
</html>